/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package skat.games;

import rlpw.lang.Factory;
import rlpw.util.Pair;
import skat.Card;
import skat.player.Player;

/**
 *
 * @author Ronny
 */
public abstract class Game implements java.util.Comparator<Pair<Player, Card>> {

    public final static String GRAND = "grand";
    public final static String ACORN = "acorn";
    public final static String GREEN = "green";
    public final static String RED = "red";
    public final static String SCHELL = "schell";
    public final static String NULL = "null";

    public int compare(Pair<Player, Card> p1, Pair<Player, Card> p2) {
        try {
            skat.comparators.Comparator comp = skat.comparators.Comparator.make(Factory.getEntriesFor(this)[0]);

            if (comp.getSortIndex(p1.right()) > comp.getSortIndex(p2.right())) {
                return -1;
            } else {
                return 1;
            }

        } catch (Exception ex) {
            ex.printStackTrace();
            return 0;
        }

    }

    public abstract boolean isTrumpCard(Card c);

    public abstract boolean isPointsCollect();


    public static Game make() throws Exception {
        return Factory.make(Game.class);
    }

    public static Game make(String name) throws Exception {
        return Factory.make(Game.class, name);
    }
}
